﻿#pragma once

#include "Containers/Vector.h"
#include "Containers/ThreadSafePtr.h"
#include "Render/Material/RenderMaterialType.h"

class CRenderTexture2D;
class CRenderTextureCube;
class CRenderShader;

class CRenderMaterial
{
public:
    CRenderMaterial()=default;

    //设置所有材质相关的东西
    void SetAllMaterialThings(std::shared_ptr<CRenderShader> InVertexShader
        , std::shared_ptr<CRenderShader> InFragmentShader
        , bool InDoubleSide
        , ERenderMaterialType InMaterialType
        , const TVector<float> & InParameters
        , const TVector<std::shared_ptr<CRenderTexture2D>> & InTexture2Ds
        , const TVector<std::shared_ptr<CRenderTextureCube>> & InTextureCubes
        );

    //只设置参数，不修改渲染管线
    void SetParameters(const TVector<float> & InParameters
        , const TVector<std::shared_ptr<CRenderTexture2D>> & InTexture2Ds
        , const TVector<std::shared_ptr<CRenderTextureCube>> & InTextureCubes
    );

protected:

    std::mutex Mutex;
    TVector<float> Parameters;
    TVector<std::shared_ptr<CRenderTexture2D>> Texture2Ds;
    TVector<std::shared_ptr<CRenderTextureCube>> TextureCubes;
    std::shared_ptr<CRenderShader> VertexShader;
    std::shared_ptr<CRenderShader> FragmentShader;
    bool bDoubleSided=false;
    ERenderMaterialType Type =  ERenderMaterialType::Unknow;

    friend struct SPreRenderContext;
};